<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>帮帮网</title>
<link href="default.css" media="screen" rel="stylesheet" />
<script type="text/javascript" src="JS/prototype.js"></script>
<script type="text/javascript" src="JS/httpRequest.js"></script>
<script type="text/javascript" src="JS/cookie.js"></script>
<script type="text/javascript" >
function Login()
{
	
	var warn=document.getElementById('warn');
	var username=document.getElementById('txtUsername').value;
	if(username==null ||username=="")
	{
		warn.innerHTML="您还没有填写账号";
		return;
	}
	var pwd=document.getElementById('txtPwd').value;
	if(pwd==null ||pwd=="")
	{
		warn.innerHTML="您还没有填写密码";
		return;
	}
	
	var url="user/user.php?action=GetUser";
	var para="username="+username;
	para+="&password="+pwd;
	var response=SendPostRequest(url,para);
	//alert(response);
	if(response=="false")
	{
		warn.innerHTML="登录失败！用户名或密码错误！";
		return;
	}
	else
	{
	//TODO
	//记录用户登录时间 并比对上次的登陆时间 刷新活跃度
		alert("您的用户ID为"+response);
		document.cookie="username"+"="+username+";path=/;";
		document.cookie="userID"+"="+response+";path=/;";
		if (username!=null || username!="")
		{
			alert('Welcome again '+username+'! 每天都登陆的话 会增加您的活跃度 但是一天之中反复登陆是没有用的哦')
		}
		else
		{
			alert('???');
		}

		//window.location.href="../index.htm";
		window.location.href="myspace.html";

	}
		
	
	
}
</script>
</head>
<body>
  <div id="all">
    <div id="header">
        <div id="inner_header" class="central_fixed_width">
		    <h1 class="logor">帮帮网</h1>
            <div id="user_status"><a href="login.htm">登陆</a>||<a href="register.html">注册</a></div>
        </div>
    </div>
    
    <div id="content" class="central_fixed_width">
        
        <div class="content_parent">
            <div class="central_form" id="login">
                <div>                    
					<h1 >人人为我 我为人人</h1>

					<form action="#">
					<table>
					<tr>
						<td></td>
							<td><span id="warn" class="warning"></span></td>
						<td></td>
					</tr>
					<tr>
						<td class="form_name">用户名：</td>
                        <td class="form_input"><input id="txtUsername" type="text" size="24" /></td>
						<td class="warning" id="nameWarn">*</td>
                    </tr>  
 					<tr>
						<td class="form_name">密码：</td>
                        <td class="form_input"><input type="password" size="24"  id="txtPwd" /></td>
						<td id="pwdWarn" class="warning">*</td>
                    </tr>  

					<tr>		
                        <td colspan="2" align="center" >
						<input class="form_submit" type="button" value="登陆" onclick="Login()" title="如果坚持每天登录的话 会按照kakassi法则给予活跃度奖励" />
						</td>
                    </tr>  
					</table>
                    </form>
                </div>
            </div>
        </div>
    </div>
    
    <div id="footer">
        <div id="inner_footer" class="central_fixed_width">


            <div class="footer_links">
                &copy; 2011 帮帮网 All rights reserved.
            </div>
            <div class="clear"></div>
            
        </div>
    </div>
  </div>
</body>
</html>

